/**
 * 安卓白金英雄坛制作组 <br>
 * 文件名：SysMenuScreen.java <br>
 * 创建时间：2013-7-22 上午11:33:22 <br>
 * 所属项目：GmudEX <br>
 * @author 12548 <br>
 */
package lostland.gmud.exv2.ui;

import lostland.gmud.exv2.GameMessageHandler;
import lostland.gmud.exv2.MapScreen;
import lostland.gmud.exv2.SavingScreen;
import lostland.gmud.exv2.expand.AboutMenuScreen;
import lostland.gmud.exv2.ui.core.MenuScreen;
import lostland.gmud.exv2.ui.core.NewButton;

/**
 * 类名：SysMenuScreen <br>
 * 说明：系统菜单
 *
 * @author 12548
 */

public class SysMenuScreen extends MenuScreen {


	/**
	 * @param instance
	 */
	public SysMenuScreen() {
		super(new SysMenuButton[]{
				new SysMenuButton(0),
				new SysMenuButton(1),
				new SysMenuButton(2),
				new SysMenuButton(3)
		});
		dummyBorder = new SysMenuBorder();
	}


	/* （非 Javadoc）
	 * @see lostland.gmud.exv2.ui.MenuScreen#onClick(int)
	 */
	@Override
	protected void onClick(int index) {
		switch (index) {
			case 0:
				new SettingScreen().pushToGame();
				break;
			case 1:
				new AboutMenuScreen().pushToGame();
				break;
			case 2:
				if (MapScreen.getInstance().getMap().extraInfo.SaveDisabled) {
					new SimpleNotificationScreen("此处禁止存档！").pushToGame();
				} else {
					new SavingScreen().pushToGame();
				}
				break;
			case 3:
				getGame().getHandler().obtainMessage(GameMessageHandler.MSG_QUIT_DIALOG).sendToTarget();
			default:
				break;
		}
	}


	/* （非 Javadoc）
	 * @see lostland.gmud.exv2.ui.MenuScreen#onCancel()
	 */
	@Override
	public void onCancel() {
		getGame().popScreen();
	}


	/* （非 Javadoc）
	 * @see lostland.gmud.exv2.ui.core.ButtonControlledScreen#show()
	 */
	@Override
	protected void show() {
		getGame().getParentScreen().present(-1);
		dummyBorder.draw();
		for (int i = 0; i < 4; i++) {
			buttons[i].draw();
		}
	}


	/* （非 Javadoc）
	 * @see lostland.gmud.exv2.ui.core.MenuScreen#onButtonDown(lostland.gmud.exv2.ui.core.NewButton)
	 */
	@Override
	protected void onButtonDown(NewButton b) {
		super.onButtonDown(b);
	}

}
